<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script>


    //增加方法
    function add() {
        var input_value = input.value;
        if (input_value == "") {
            alert("请输入内容");
            return;
        }

        var content = document.createElement("p");

        content.innerHTML = input_value +"&nbsp;"+
            "<button onclick='remove(this)'>删除</button>";
        main_content.appendChild(content);
        input.value = "";
    }

    //单个删除
    function remove(obj) {
        obj.parentNode.parentNode.removeChild(obj.parentNode);
    }
</script>
<body>

<div>
    <input type="text" placeholder="请输入备注信息" id="input"/>
    <button type="submit" onclick="add()">添加</button>
</div>
<div>
    <h2>待办事项列表如下:</h2>
    <div id="main_content">
        <p>&nbsp;&nbsp;&nbsp;你当前还没有待办事项哦!</p>
    </div>
</div>

</body>
</html>